package yanyan.com.tochar.beans;

import android.content.Context;
import android.graphics.Bitmap;

import java.util.ArrayList;
import java.util.HashMap;

public class VideoThreadInfo {
    private String fileName;  //文件名称
    private Bitmap bitmap;    //位图
    private boolean isColor;   //是否彩色
    private String txt;       //自定义的字符图文本
    private Context context;   //
    private int width;
    private int heigth;
    private boolean isCN;//是否为汉字

    private  static HashMap<Integer,String> paths=null;

    public VideoThreadInfo() {
    }

    public VideoThreadInfo(Context context,String fileName, Bitmap bitmap, boolean isColor, String txt) {
        this.context=context;
        this.fileName = fileName;
        this.bitmap = bitmap;
        this.isColor = isColor;
        this.txt = txt;
    }

    public VideoThreadInfo(Context context,String fileName, Bitmap bitmap, boolean isColor, String txt,boolean isCN) {
        this.context=context;
        this.fileName = fileName;
        this.bitmap = bitmap;
        this.isColor = isColor;
        this.txt = txt;
    }



    /**
     * 初始化,开始生成字符图之前调用
     */
    public static void initMap(){
        paths=new HashMap<>();
    }


    /**
     * 根据list大小获取进度
     * @return
     */
    public static int getIndex(){
        return paths.size();
    }

    /**
     * 添加缓存路径
     * @param path
     */
    public synchronized static void setIndex(String path,String text){
        int start= path.lastIndexOf("_")+1;
        int end =path.indexOf(".",start);

        String index=path.substring(start,end);
        paths.put(Integer.parseInt(index),path);
    }

    /**
     * 获取map
     * @return
     */
    public static HashMap<Integer,String> getMap(){
        return paths;
    }


    public Context getContext() {
        return context;
    }

    public void setContext(Context context) {
        this.context = context;
    }

    public boolean isColor() {
        return isColor;
    }

    public void setColor(boolean color) {
        isColor = color;
    }

    public String getTxt() {
        return txt;
    }

    public void setTxt(String txt) {
        this.txt = txt;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public Bitmap getBitmap() {
        return bitmap;
    }

    public void setBitmap(Bitmap bitmap) {
        this.bitmap = bitmap;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeigth() {
        return heigth;
    }

    public void setHeigth(int heigth) {
        this.heigth = heigth;
    }

    public boolean isCN() {
        return isCN;
    }

    public void setCN(boolean CN) {
        isCN = CN;
    }
}
